package logs

import (
	"log"
	"os"
	"sync"
)

var f *os.File
var err error
var mu sync.Mutex

func init() {
	f, err = os.Create("logs/debug.log")
	if err != nil {
		log.Fatal(err)
	}
}
func PrintLog(a ...interface{}) {
	mu.Lock()
	defer mu.Unlock()
	f, _ = os.OpenFile("logs/debug.log", os.O_APPEND|os.O_WRONLY, 0644)
	defer f.Close()

	// 设置日志输出到文件
	log.SetOutput(f)
	log.Println(a...)
}
